package cn.grf.datasource.flex.service;

import cn.grf.datasource.flex.pojo.Account;
import cn.grf.datasource.flex.pojo.mapper.AccountMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author grf
 * @apiNote
 * @since 2025/4/23
 */
@Service
@RequiredArgsConstructor
public class AccountService {
    private final AccountMapper accountMapper;


    // @DS("slave")
    public void insert(Account account) {
        accountMapper.insert(account);
    }

    public List<Account> list() {
        return accountMapper.selectAll();
    }
    // @UseDataSource("master")
    public Account get(Long id) {
        return accountMapper.selectOneById(id);
    }
}
